import request from "../request.js"

//登录接口
function doLogin(data){
	return request({
		url:"/lejuClient/login/doLogin",
		data,
		method:"POST"
	})
}

//获取用户信息
function getMemberInfo(data){
	return request({
		url:"/lejuClient/login/getMemberInfo",
		data,
	})
}


//查询地址列表
function findAllAddress(data){
	return request({
		url:"/lejuClient/address/findAllAddress",
		data,
	})
}


//删除地址
function delAddressInfo(id,data){
	return request({
		url:`/lejuClient/address/delAddressInfo/${id}`,
		data,
		method:"delete"
	})
}


//更新收获地址
function updateAddressInfo(data){
	return request({
		url:"/lejuClient/address/updateAddressInfo",
		data,
		method:"POST"
	})
}

//获取购物车列表
function findAllCartItem(data){
	return request({
		url:"/lejuClient/cart/findAllCartItem",
		data
	})
}

//切换默认地址
function switchDefault(id,status,data){
	return request({
		url:`/lejuClient/address/switchDefault/${id}/${status}`,
		data,
		method:"POST"
	})
}

//添加收获地址
function addAddressInfo(data){
	return request({
		url:"/lejuClient/address/addAddressInfo",
		data,
		method:"POST"
	})
}

//生成订单
function addPreOrder(data){
	return request({
		url:"/lejuClient/order/addPreOrder",
		data,
		method:"POST"
	})
}

//获取订单编号
function getPreOrderById(orderId,data){
	return request({
		url:`/lejuClient/order/getPreOrderById/${orderId}`,
		data,
	})
}

//查询订单列表
function findAllOrders(orderId,data){
	return request({
		url:"/lejuClient/order/findAllOrders",
		data,
	})
}



export {
	doLogin,getMemberInfo,findAllAddress,delAddressInfo,updateAddressInfo,findAllCartItem,
	switchDefault,addAddressInfo,addPreOrder,getPreOrderById,findAllOrders
}
